package org.example.funtion;

/**
 *
 */
public class StrTest01 {

    public static void main(String[] args) {

        StrFun strFun = (str) -> str.toUpperCase();

        String res = strFun.getStr("abc");
        System.out.println(res);//ABC


        //再将一个字符串的第二个和第四个索引位置进行截取字串
        StrFun strFun2 = (str) -> {
            int len = str.length();
            if (len < 2 || len < 4) {
                return str;
            }
            return str.substring(1,4);
        };

        String res2 = strFun2.getStr("hamburger");
        System.out.println(res2);//amb
    }
}
